package user

var sqlGetUserForLogin = `
SELECT id, name, user_name,password, phone_number, status, last_login_time, max_failures, current_failures, last_failure_time
FROM user_login_#tenant_id
WHERE user_name = @user_name;
`

var sqlGetUserByUserName = `
SELECT id, name, user_name, phone_number, status, last_login_time, max_failures, current_failures, last_failure_time
FROM user_login_#tenant_id
WHERE user_name = @user_name;
`

var sqlUpdateLoginFailures = `
UPDATE user_login_#tenant_id
SET current_failures = current_failures + 1, last_failure_time = NOW()
WHERE user_name = @user_name AND current_failures < max_failures;
`

var sqlResetLoginFailures = `
UPDATE user_login_#tenant_id
SET current_failures = 0, last_login_time = NOW()
WHERE user_name = @user_name;
`
